<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <style media="screen">
    .shadow {
      position: fixed;
      width: 100%;
      height: 100%;
      background: #000;
      opacity: 0.3;
      filter: alpha(30);
      left: 0;
      top: 0;
    }

    .mod_dialog {
      width: 300px;
      height: 200px;
      border: 1px solid black;
      background: #fff;
      position: fixed;
      left: 50%;
      top: 50%;
      margin-left: -150px;
      margin-top: -100px
    }
  </style>
  <title></title>
</head>

<body>
  <div class="page">
    <% include components/top.inc.ejs %>
    <div class="content-wrap">
      <div>
        <form action="?" method="post" enctype="multipart/form-data">
          标题：<input type="text" name="title" /><br>
          描述：<textarea name="description"></textarea><br>
          头像：<input type="file" name="f1" /><br>
          <input type="submit" value="添加" />
        </form>
      </div>
      <table border="1" width="100%">
        <thead>
          <tr>
            <th>ID</th>
            <th>标题</th>
            <th>描述</th>
            <th>头像</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <% for(var i=0;i<evaluations.length;i++){ %>
          <tr>
            <td><%=evaluations[i].ID%></td>
            <td><%=evaluations[i].title%></td>
            <td><%=evaluations[i].description%></td>
            <td><img width="32" height="32" src="/upload/<%=evaluations[i].src%>" /></td>
            <td>
              <a href="?act=mod&id=<%=evaluations[i].ID%>">修改</a>
              <a href="?act=del&id=<%=evaluations[i].ID%>" onclick="return confirm('你真的要删吗？')">删除</a>
            </td>
          </tr>
          <% } %>
        </tbody>
      </table>
      <% if(typeof mod_data!='undefined'){ %>
      <div class="shadow"></div>
      <div class="mod_dialog">
        <form action="?" method="post">
          <input type="hidden" name="mod_id" value="<%= mod_data.ID %>" />
          标题：<input type="text" name="title" value="<%= mod_data.title %>" /><br>
          描述：<textarea name="description"><%= mod_data.description %></textarea><br>
          头像：<input type="file" name="f1" /><br>
          <input type="submit" value="修改" />
          <a href="/admin/custom">取消修改</a>
        </form>
      </div>
      <% } %>
    </div>
  </div>
</body>

</html>